returns X and Y coordinate given i and j position in grid(i,j)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | i | |||
integer, | intent(in) | :: | j | |||
type(grid_real), | intent(in) | :: | grid | |||
real(kind=float), | intent(out) | :: | X | |||
real(kind=float), | intent(out) | :: | Y | |||
logical, | intent(out), | optional | :: | check |
return false if i and j are outside grid definition |
SUBROUTINE GetXYfloat & ! (i, j, grid, X, Y, check) IMPLICIT NONE !Arguments with intent(in): TYPE (grid_real), INTENT(IN) :: grid INTEGER, INTENT(IN) :: i, j !Arguments with intent(out): REAL (KIND = float), INTENT(OUT) :: X,Y LOGICAL, OPTIONAL, INTENT(OUT) :: check !!return false if i and j are outside grid definition !------------end of declaration------------------------------------------------ IF (i < 1 .OR. i > grid % idim .OR. j < 1 .OR. j > grid % jdim ) THEN X = 0. Y = 0. IF ( PRESENT(check) ) check = .FALSE. ELSE X = grid % xllcorner + (j - 0.5) * grid % cellsize Y = grid % yllcorner + (grid % idim - i + 0.5) * grid % cellsize IF ( PRESENT(check) ) check = .TRUE. END IF END SUBROUTINE GetXYfloat